package o;

import android.app.Activity;
import com.huawei.appgallery.foundation.store.bean.detail.DetailResponse;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse.LayoutData;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import java.util.Iterator;
import java.util.List;

public class ctr {
    private static boolean ˋ(int i) {
        return i == 0 || i == 2 || i == 3 || i == 4;
    }

    private static void ˏ(List<LayoutData<CardBean>> list, int i) {
        if (!CollectCheck.isEmpty((List) list)) {
            for (LayoutData layoutData : list) {
                layoutData.ˎ(i);
                layoutData.ॱ(i);
            }
        }
    }

    public static void ˋ(List<LayoutData<CardBean>> list, boolean z, boolean z2) {
        if (z) {
            ˏ(list, 0);
        }
        if (z2) {
            ˏ(list, 1);
        }
    }

    public static void ˎ(Activity activity, ResponseBean responseBean, boolean z) {
        List<LayoutData> ᐝॱ = ((DetailResponse) responseBean).ᐝॱ();
        if (!CollectCheck.isEmpty((List) ᐝॱ)) {
            ctq ˊ = ctt.ˋ().ˊ();
            boolean z2 = false;
            for (LayoutData ˋ : ᐝॱ) {
                List ˋ2 = ˋ.ˋ();
                if (!(ˋ2 == null || ˋ2.isEmpty())) {
                    Iterator it = ˋ2.iterator();
                    boolean z3 = z2;
                    while (it.hasNext()) {
                        CardBean cardBean = (CardBean) it.next();
                        if (ˊ.ॱ(cardBean)) {
                            it.remove();
                        }
                        if (!(z3 || !z || ((cdg) cdb.ॱ(cdg.class)).ॱॱ(cardBean.ॱـ()))) {
                            z3 = true;
                        }
                    }
                    z2 = z3;
                }
            }
            ॱ(activity, z2, z);
        }
    }

    public static void ˋ(cia o_cia) {
        List<chz> ʻॱ = o_cia.ʻॱ();
        if (!CollectCheck.isEmpty((List) ʻॱ)) {
            for (chz ˏ : ʻॱ) {
                List ˏ2 = ˏ.ˏ();
                if (ˏ2 != null) {
                    Iterator it = ˏ2.iterator();
                    while (it.hasNext()) {
                        if (ˋ(((cdg) cdb.ॱ(cdg.class)).ˋ(((CardBean) it.next()).ॱـ()))) {
                            it.remove();
                        }
                    }
                }
            }
        }
    }

    public static boolean ˏ(cia o_cia) {
        List<chz> ʻॱ = o_cia.ʻॱ();
        if (CollectCheck.isEmpty((List) ʻॱ)) {
            return false;
        }
        boolean z;
        loop0:
        for (chz ˏ : ʻॱ) {
            List<CardBean> ˏ2 = ˏ.ˏ();
            if (ˏ2 != null) {
                for (CardBean ॱـ : ˏ2) {
                    if (!((cdg) cdb.ॱ(cdg.class)).ॱॱ(ॱـ.ॱـ())) {
                        z = true;
                        break loop0;
                    }
                }
                continue;
            }
        }
        z = false;
        return z;
    }

    public static void ˏ(Activity activity) {
        if (activity instanceof cto) {
            ((cto) activity).ˊˋ();
        }
    }

    public static void ॱ(Activity activity, boolean z, boolean z2) {
        if ((activity instanceof cth) && z2) {
            ((cth) activity).ॱ(z);
            ˏ(activity);
        }
    }
}
